﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace TraceThisItem.Domain
{
	public class Team
	{
		public int Id { get; set; }
		public string Name { get; set; }
		public int ProjectId { get; set; }
		
		public virtual ICollection<User> Users { get; set; }
		public virtual Project Project { get; set; }

		public void AddUser(User user)
		{
			this.Users.Add(user);
		}

		public void RemoveUser(User user)
		{
			this.Users.Remove(user);
		}

		public bool ContainsUser(User user)
		{
			return this.Users.Contains(user);
		}

		public Team()
		{
			this.Users = new List<User>();
		}

		public string ProjectName { get { return Project != null ? Project.Name : String.Empty; } }

		public override string ToString()
		{
			return this.Name;
		}
	}
}
